cmake_minimum_required(VERSION 3.5)

project(myrender VERSION 0.1 LANGUAGES CXX)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
# set(CMAKE_PREFIX_PATH "d:/Programs/Qt/6.10.0/mingw_64")  # Qt Kit Dir
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_EXTENSIONS OFF) # 禁用 C++ 扩展 for test
# set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # enable compile_commands.json for IntelliSense 

include_directories(${PROJECT_SOURCE_DIR})
include_directories(src)

# file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}" NATIVE_PROJECT_PATH)
add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_SOURCE_DIR}")

# options
option(test "open test" OFF)


add_subdirectory(src)
if (test)
    add_subdirectory(test)
endif()
